/* vector 未雨绸缪机制 */
/*
1
2
4
8
16
32
64
128
256
512
1024
2048
4096
8192
*/
#include <vector>
#include <iostream>
#include <ctime>
#include <unistd.h>

using namespace std;
void my_print(vector<int> &v);
int main(int argc, char **argv)
{
    int i = 0;
    vector<int> v;

    auto cap = v.capacity();
    while (1)
    {
        v.push_back(i);
        i++;
        if (cap != v.capacity())
        {
            cout << v.capacity() << endl;
            cap = v.capacity();
        }
        
    } /* end of while (1) */



    return 0;
}

void my_print(vector<int> &v)
{
    vector<int>::iterator it = v.begin();

    for (; it != v.end(); it++)
    {

        cout << *it << " ";
    }

    cout << endl;

    return;
}